<template>
  <div ref="OrderDistributionEcharts" style="height:300px;width:500" />
</template>

<script>
import { orderDistributeStatic } from '@/api/static'
export default {
  name: 'OrderDistribute',
  mounted() {
    this.myEhcarts()
  },
  methods: {
    myEhcarts() {
      const reverseDis = orderDistributeStatic.reverse()
      const option = {
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            type: 'shadow'
          }
        },
        legend: {},
        grid: {
          left: '3%',
          right: '4%',
          bottom: '3%',
          containLabel: true
        },
        xAxis: {
          type: 'value',
          boundaryGap: [0, 0.01]
        },
        yAxis: {
          type: 'category',
          // reverse 修改的是原数组
          data: reverseDis.map(item => {
            return item.name
          })
        },
        series: [
          {

            type: 'bar',
            data: reverseDis.map(item => {
              return item.value
            }),
            color: 'orange'
          }
        ]
      }
      this.$echarts.init(this.$refs.OrderDistributionEcharts).setOption(option)
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
